﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraBars;
using DevExpress.XtraNavBar;
using System.Threading;
using DevExpress.XtraSplashScreen;
using DevFramework.Util;

namespace DevFramework.WinUI
{
    public partial class FormPort : DevExpress.XtraBars.Ribbon.RibbonForm
    {
        public FormPort()
        {
            InitializeComponent();
            ThreadWaitOrSplash.StartSplashThread();
            Thread.Sleep(80000);
            ThreadWaitOrSplash.StopSplashThread();
        }

        private void navBarControl1_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            AddPageMdi(e.Link.Item);
        }

        private void AddPageMdi(NavBarItem item)
        {
            Person childForm = new Person();
            childForm.MdiParent = this;
            // 子窗体的 Text  就是 Tab页中的标题 ,我这里是直接取 navItem中的标题作为 tab页的标题
            childForm.Text = navItem.Caption;// + tabCount++;
            // 显示 
            childForm.Show();
            // 设置当前 tab页的 图标,我这里也默认取navBar中的Item中的图标
            //xtraTabbedMdiManager1.Pages[subform].Image = navBarControl1.SmallImage;
        }

        private void barButtonItem1_ItemClick(object sender, ItemClickEventArgs e)
        {
            SplashScreenManager.ShowForm(typeof(WaitForm1));
            for (int i = 0; i < 200; i++)
            {
                Thread.Sleep(200);
            }
            SplashScreenManager.CloseForm();
        }
    }
}